<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

// ------------------------------------------------------------------------

/**
 * Display Message
 *
 * Create a local URL based on your basepath. Segments can be passed via the
 * first parameter either as a string or an array.
 *
 * @access	public
 * @param	string
 * @return	string
 */
if (!function_exists('clean_array_for_dropdown')) {
	function clean_array_for_dropdown($array, $id, $val) {
		if (!isset($array) || count($array) < 1) {
			return NULL;
		} else {
			$new_array[0]="Please select an option";	
			foreach ($array as $key => $value) {

				if (array_key_exists($id, $value) && array_key_exists($val, $value))

					$new_array[$value[$id]] = $value[$val];

			}

			return (isset($new_array) && count($new_array) > 0) ? $new_array : NULL;
		}
	}

}
?>